Skip to content

fix: VAULT_SKIP_VERIFY=false turns TLS verification off - #430

Open
bruno-costanzo wants to merge 1 commit into
hashicorp:masterfrom
bruno-costanzo:fix/skip-verify-boolean
Open

bruno-costanzo wants to merge 1 commit into
hashicorp:masterfrom
bruno-costanzo:fix/skip-verify-boolean

Conversation

@bruno-costanzo

Copy link
Copy Markdown

Defaults.ssl_verify turns TLS verification off when VAULT_SKIP_VERIFY is set to any value, including false or 0:

if !ENV["VAULT_SKIP_VERIFY"].nil?
  return false
end

The Vault CLI reads the same variable as a boolean (strconv.ParseBool), so VAULT_SKIP_VERIFY=false keeps verification on there. Deployment files often set VAULT_SKIP_VERIFY: "false" explicitly: the CLI then verifies the certificate, but an app that uses the gem defaults accepts any certificate, with no warning.

VAULT_SSL_VERIFY=1 turns verification off too, because only values that start with t or y count as true.

Against a local HTTPS server with a self-signed certificate:

vault CLI, VAULT_SKIP_VERIFY=false  -> x509: certificate signed by unknown authority
this gem,  VAULT_SKIP_VERIFY=false  -> ssl_verify == false, request succeeds

This change reads both variables as booleans, like the CLI (1/t/true/y/yes and 0/f/false/n/no, any case). A value that is not a boolean keeps verification on. Apps that set ssl_verify in code are not affected.

The new specs in spec/unit/defaults_spec.rb fail on master (8 of them) and pass with the change. bundle exec rspec spec/unit: 212 examples, 0 failures.

Any value of VAULT_SKIP_VERIFY, also false or 0, turned verification off,
while the Vault CLI reads it as a boolean. VAULT_SSL_VERIFY=1 turned it
off too. Read both as booleans, and keep verification on for a value that
is not one.
@bruno-costanzo
bruno-costanzo requested a review from a team as a code owner November 3, 2026 14:31
@hashicorp-cla-app

hashicorp-cla-app Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant